Auto-tuning reliability protocol in pub-sub RTPS systems

ABSTRACT

Adaptive tuning techniques are provided for data communications in an Object Management Group (OMG) Real-Time Publish Subscribe (RTPS) Protocol operable over a communication network to provide good throughput/latency tradeoff as well as efficient bandwidth utilization. With this invention, latency under high throughput conditions can be reduced several times compared with the latency obtained with traditional non-adaptive approaches.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.14/994,995 filed Jan. 13, 2016, which is incorporated herein byreference. U.S. patent application Ser. No. 14/994,995 filed Jan. 13,2016 claims priority from U.S. Provisional Patent Application 62/104,318filed Jan. 16, 2015, which is incorporated herein by reference.

FIELD OF THE INVENTION

This invention relates to methods and systems for auto-tuning reliablecommunications in systems using the OMG Real-Time Publish Subscribe(RTPS) Protocol.

BACKGROUND OF THE INVENTION

Many distributed systems employ a publish-subscribe data exchange inwhich applications publish data samples, which become available toremote applications interested in them.

The Object Management Group (OMG) Real-Time Publish-Subscribe Protocol(RTPS) specification has become one of the popular protocols forpublish-subscribe communications. Moreover RTPS is the interoperabilitywire protocol for systems that implement the OMG Data DistributionService (DDS) a specification of a publish-subscribe middleware createdin response to the need to standardize a data-centric publish-subscribeprogramming model for distributed systems.

The RTPS protocol provides a way to send data-samples from a Writer to aReader reliably where each sample is identified by a writer globalsource identifier (GUID) and a sequence number. Even if the underlyingprotocol is not reliable, such as UDP (User Datagram Protocol), themessages will be delivered to the Reader in order and missing samplescan be resent.

To do that, the RTPS protocol defines three protocol messages:

-   -   HEARTBEAT: Describes the information (samples) that is available        in a Writer. HEARTBEAT messages are sent by a Writer to one or        more Readers.    -   DATA: This message encapsulates a sample containing the        application's user data, sequence number and other relevant        information.    -   ACKNACK: Allows the Reader to inform the Writer about the        samples it has received and which ones it is still missing. This        message can be used to do both positive and negative        acknowledgments. ACKNACK messages are sent in response to        HEARTBEATs.

FIG. 1 shows a basic message exchange between a Writer and a Reader. Inthis exchange one of the samples is lost and subsequently repaired whenthe Writer receives a NACK.

Although the RTPS protocol describes the basic behavior of Writers andReaders to guarantee interoperability, it does not provide guidelines onhow to optimize the sending of DATA, HEARTBEAT, and ACKNACK messages toobtain best performance and resource utilization and adapt to changingnetwork conditions. This is especially critical in dynamic systems wherethe resources available for a Writer/Reader pair such as bandwidth, CPU,and memory change over time.

For example, a Writer and a Reader could be exchanging DATA messageswithout losses in a 1 Gb network. The appearance of a new pairWriter/Reader with which they have to share bandwidth may startintroducing sample losses. The additional traffic generated by repairDATA messages reduces the available bandwidth, increases the samples'latency, and reduces the throughput for new samples sent from the Writerto the Reader. The network conditions may also change as the data maytraverse over shared networks with varying loads, and/or over wirelessor radio links whose physical properties may change over time.

To further advance the art, the present invention provides a systemand/or method to adaptively auto-tune reliable communications in an RTPSsystem to provide a good throughput/latency tradeoff as well asefficient bandwidth utilization.

SUMMARY OF THE INVENTION

The present invention provides a method for adaptively auto-tuning datacommunications over a communication network where an Object ManagementGroup (OMG) Real-Time Publish Subscribe (RTPS) Protocol is operable overthe communication network running a software application. Samples arewritten to an RTPS-Writer, and the RTPS-Writer sends the samplesencapsulated in an RTPS-DATA message to an RTPS-Reader. A Send Window isdefined between the RTPS-Writer and RTPS-Reader. A Send Window Size inthe number of the RTPS-DATA messages is defined between the RTPS-Writerand RTPS-Reader. A Writing Rate is defined for the RTPS-Writer.

A first auto-tuning protocol is implemented as a computer softwareexecutable by a computer for dynamically adjusting the Send Window Sizebased on the number of RTPS-NACK messages received by the RTPS-Writer.The RTPS-NACK message is defined as a message sent from the RTPS-Readerto the RTPS-Writer indicating that some of the RTPS-DATA messages aremissing.

A second auto-tuning protocol implemented as a computer softwareexecutable by the computer for dynamically adjusting the Sending Rate toavoid that: (i) the number of samples in the Send Window equals the sizeof the Send Window, and (ii) the RTPS-Writer blocks or yields CPU afterfilling up Send Window.

A third auto-tuning protocol could further be implemented as a computersoftware executable by the computer for dynamically adjusting the sizeof an RTPS-BATCH based on the publication rate. The RTPS-BATCH isdefined as an RTPS-DATA message encapsulating more than one sample. Thepublication rate is defined as the number of samples written with theRTPS-Writer per second.

The first and second auto-tuning protocol of the present inventionreduce the communication latency between an RTPS-Writer and anRTPS-Reader under high throughput conditions where high throughputconditions are conditions in which the rate at which samples arepublished with an RTPS-Writer is greater than the rate at which thesamples can be received and positively acknowledged by an RTPS-Readerbased on the resources available for the Writer/Reader pair such asbandwidth, CPU, and memory. These two auto-tuning protocols provide alatency reduction of several times the latency obtained with traditionalapproaches based on having a fix Send Window Size.

The third auto-tuning protocol of the present invention provides a wayto obtain a good throughput/latency tradeoff between an RTPS-Writer andan RTPS-Reader under scenarios in which the publication rate changesover time. Current approaches using fix size batches provide poorlatency for low publication rates (a few samples per second). Thislatency can be several orders of magnitude higher than the latencyprovided with the auto-tuning protocol of the present invention.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a Basic reliable RTPS Message Exchange according to thecurrent state of the art. HB=HEARTBEAT, ACK=Positive acknowledgment andNACK=Negative acknowledgment.

FIG. 2 shows a Send Window Update Algorithm according to an exemplaryembodiment of the invention.

FIGS. 3-4 combined show the Send Rate Adjustment Algorithm according toan exemplary embodiment of the invention

FIG. 5 shows a Writer Without Batching according to an exemplaryembodiment of the invention.

FIG. 6 shows a Writer With Batching according to an exemplary embodimentof the invention.

FIG. 7 shows a Batch Size Adjustment Algorithm according to an exemplaryembodiment of the invention.

FIG. 8 shows a Writer with Dynamic Batching according to an exemplaryembodiment of the invention. In this example only during higherpublication frequency will data be batched to trade away low latency infavor of better throughput. In our specific implementation we used alinear interpolation to calculate the batch size. This is describedinfra in detail:(WriteFrequency−MinFrequency)/(MaxFrequency−MinFrequency))*MaxBatchSize.

In this exemplary implementation, we set MinFrequency to 10 samples persecond, MaxFrequency to 10000 samples per second and MaxBatchSize to 32KB (it is noted that these are all configuration parameters). The higherthe frequency the more data we batch up to a maximum of 32 KB. Writingmore than 10000 samples per second will always result in 32 KB batches.

FIGS. 9-10 shows according to an exemplary embodiment of the inventionthe performance improvements to latency average (FIG. 9) and latencyjitter (FIG. 10) by using (i) the system/method of this invention fordynamic adjustment of the send window size, (ii) the system/method ofthis invention for dynamic adjustment of the writing rate.

FIG. 11 shows a according to an exemplary embodiment of the inventionperformance improvements to latency average by using dynamic samplebatching versus direct batching.

DETAILED DESCRIPTION

Dynamic Adjustment of the Send Window Size

The first auto-tuning mechanism includes maintaining a send window ofvariable size on the Writer to provide a flow control mechanism. If thenetwork is congested, for example, the Writer will stop writing samples.

A Writer blocks when it tries to send a sample and the send window isfull. Samples are removed from the send window as soon as they areacknowledged by all the Readers to which the Writer must send thesamples.

The size of the send window is updated periodically based on the numberof RTPS NACK messages received by the Writer since the last update. FIG.2 describes the window size update algorithm. In the algorithm:

-   -   The window size is updated within the interval        [MinSendWindowSize,MaxSendWindowSize]    -   The window size is increased by a factor IncreaseWindowFactor        where IncreaseWindowFactor>1    -   The window size is decreased by a factor DecreaseWindowFactor        where DecreaseWindowFactor is strictly between 0 and 1, that is        0<DecreaseWindowFactor<1.    -   UpdatePeriod is the update period    -   RecvNACKs is the number of NACK messages received by the Writer        in the current UpdatePeriod    -   PrevRecvNACKs is the value of RecvNACKs in the previous        UpdatePeriod.

Dynamic Adjustment of the Sending Rate

By introducing a variable send window size we provide a method to doflow control between the Writer and Reader(s) based on the number ofNACKs received. This method optimizes the bandwidth usage and improvesthe average sample latency by reducing the number of repairs. However,samples that block the Writer will add a high latency component and theywill increase jitter.

To reduce the latency jitter we introduce a method that dynamicallyadjusts the sending rate by doing busy-waiting between writes. This waythe send window does not fill up and the Writer never blocks and yieldsCPU. FIGS. 3 and 4 describe the rate adjustment algorithm. In thealgorithm:

-   -   CurrentSpinMicrosecondCount indicates the number of microseconds        of busy-wait    -   MaxSpinMicrosecondCount indicates the maximum number of        microseconds of busy-wait    -   SpinMicrosecondIncrement indicates by how many microseconds the        busy-wait can increase between consecutive writes    -   SpinMicrosecondDecrement indicates by how many microseconds the        busy-wait can decrease between consecutive writes    -   CurrentSampleCount is the number of samples sent since the        Writer started. The CurrentSpinMicrosecondCount used to do        busy-wait is recalculated every SpinUpdateSampleCount    -   LowSendWindowSizeThreshold and HighSendWindowSizeThreshold are        used to determine when to update CurrentSpinMicrosecondCount.        The idea is to keep the number of unacknowledged samples in the        send window between these two thresholds.    -   ElapsedTime is the time elapsed in microseconds since the        previous write operation (LastWriteTime). The amount of        busy-wait is only adjusted every certain number of samples in        order to allow the algorithm to stabilize. Because of this, if        the speed at which the application writes samples decreases to a        level in which spin is not necessary, the algorithm would be        introducing an unnecessary component of latency until the spin        becomes 0. To accomplish this the algorithm will not do        busy-wait if the ElapsedTime is already greater than the        CurrentSpinMicrosecondCount required.

Dynamic Sample Batching

The exchange of multiple RTPS messages, including DATA, HEARTBEAT andACKNACK, to provide reliable communications between a Writer and one ormultiple Readers introduces an overhead in bandwidth and CPU usage thataffects the effective sample throughput in terms of samples per second.

The number of DATA, HEARTBEAT and ACKNACK messages can be reduced bygrouping multiple application changes (samples) into a single RTPS DATAmessage. This practice is commonly known as message batching or messageaggregation. When this is done the effective throughput can be increaseddramatically, especially for small data samples (size<2048 bytes).Batching many smaller samples to be sent in a single RTPS DATA messageoptimizes bandwidth usage, reduces CPU utilization, and thus improvesthroughput.

FIG. 5 shows the Writer behavior without batching. FIG. 6 shows theWriter behavior with batching. In this case, multiple samples up to anumber of samples or number of bytes are grouped and sent together intoa single DATA RTPS message. There is also a configurable flush delayafter which the current batch (independently of the number of samplessent on the network) is sent.

The problem with a direct batching implementation is that although thethroughput is dramatically increased at high publication rates, there isa significant penalty in latency at low publication rates as shown inFIG. 6.

To mitigate this problem embodiments of this invention provide atechnique for dynamically adjusting the size of a batch based on thecurrent publication rate. This provides a good throughput/latencytradeoff. FIG. 7 describes the algorithm that adjusts the batch size. Inthe algorithm:

-   -   The batch size (in bytes) is adjusted every        SamplesPerReevaluation    -   The batch size is adjusted between [1, MaxBatchSize] based on        the write rate WriteFrequency    -   The WriteFrequency is calculated without accounting for the        blocking time (TotalBlokcingTimeSinceFirstWrite) generated        because the Send Window is full    -   GetBatchSize calculates the size of the batch based on the        WriteFrequency. This function must be monotonic between 1 (for        WriteFrequency=MinFrequency) and MaxBatchSize (for        WriteFrequency=MaxFrequency). A possible implementation is to        use a linear interpolation:    -   (WriteFrequency−MinFrequency)/(MaxFrequency−MinFrequency))*MaxBatchSize;

Adjusting the batch size dynamically provides a good throughput/latencytradeoff under scenarios in which the publication rate changes over timeas shown in FIG. 8. Current approaches using fix size batches providepoor latency for low publication rates (a few samples per second). Thislatency can be several orders of magnitude higher than the latencyprovided with the auto-tuning protocol of the present invention.

Performance

The system/method for auto-tune reliable communications in RTPSPublish-Subscribe systems have been incorporated into the latest RTIConnext DDS 5.1.0. FIGS. 9-10 show the performance improvements tolatency average and jitter by using:

-   -   The system/method of this invention for dynamic adjustment of        the send window size.    -   The system/method of this invention for dynamic adjustment of        the writing rate.

FIG. 11 shows the performance improvements to latency average by usingdynamic sample batching versus direct batching. In FIG. 11, every threerows represent a single run, so the publication rate (the demand)fluctuates during the same run. The first three rows represent nobatching. The next three rows represent vanilla batching. The last threerows represent dynamic batching. The results are consistent with FIGS.5, 6, and 8.

Embodiments of the invention can be envisioned as a system and/orcomputer-implemented methods executed by a computer either standalone orpart of a system in a communication network e.g. over the Internet.

What is claimed is:
 1. A method for adaptively auto-tuning datacommunications over a communication network, comprising: having anObject Management Group (OMG) Real-Time Publish Subscribe (RTPS)Protocol operable over the communication network with a softwareapplication writing samples to an RTPS-Writer, the RTPS-Writer sendingthe software application written samples encapsulated in an RTPS-DATAmessage to an RTPS-Reader, a Send Window defined between the RTPS-Writerand RTPS-Reader, a Send Window Size in a number of the RTPS-DATAmessages defined between the RTPS-Writer and RTPS-Reader, and a WritingRate defined for the RTPS-Writer; having a first auto-tuning method,implemented as a computer software executable by a computer, fordynamically and automatically adjusting the Send Window Size based on anumber of RTPS-NACK messages received by the RTPS-Writer, wherein theRTPS-NACK message is defined as a message sent from the RTPS-Reader tothe RTPS-Writer indicating that some of the RTPS-DATA messages aremissing; having a second auto-tuning method, implemented as a computersoftware executable by the computer, for dynamically and automaticallyadjusting the Sending Rate to avoid that: (i) a number of samples in theSend Window equals the size of the Send Window, and (ii) the RTPS-Writerblocks or yields CPU.